<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglib.jsp" %>    
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script>

	var selRoleId = null;
	
	$(document).ready(function() {
	
		// 选择表格行
		$("#gridOrgRole table > tbody > tr").click(function() {
			$("#gridOrgRole table > tbody > tr").removeClass('info');
			$(this).addClass('info');
			selRoleId = $(this)[0].id;
		});
		
	});
	
	function btn_ok_click() {
		if (selRoleId == null) {
			alert("请选择角色");
			return;
   	 	}
		
		onSelectRoleEvent(selRoleId);
	}

</script>

</head>

<body>

<div class="modal-header">
	<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
		&times;
	</button>
	<h4 class="modal-title">选择角色</h4>
</div>

<div class="modal-body">
	<div id="gridOrgRole" class="table-responsive">
	  <table class="table table-hover table-bordered">
	    <thead>
	      <tr>
	    	<th>所属应用</th>
	      	<th>角色名称</th>
	    </thead>
	    <tbody>
			<c:forEach items="${listRole}" var="node" varStatus="status">		
				<tr id='${node.roleId}'>
				<td>${node.appName}</td>	
				<td>${node.roleName}</td>
				</tr>
			</c:forEach>
	    </tbody>
	  </table>
	</div>
</div>

<div class="modal-footer">	
	<button type="button" class="btn btn-primary" onclick="btn_ok_click();">确定</button>
	<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>	
</div>
   	
</body>
</html>
